<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="70px">
	  <el-form-item label="时间">
      <el-date-picker
        v-model="dateRange"
        size="small"
        style="width: 350px"
        value-format="yyyy-MM-dd HH:mm:ss"
        type="datetimerange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期">
      </el-date-picker>
	  </el-form-item>

      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"

        >导出</el-button>
      </el-form-item>
    </el-form>
<!--    v-hasPermi="['system:WorkLog:exportUnusual']"-->
<!-- bbbbbb -->
<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['system:WorkLog:Unusualexport']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
<!--	    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!--    </el-row>-->
<!--     bbbbbb -->
    <el-table v-loading="loading" :data="UnusualList" >
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
	    <el-table-column label="BCR编号" align="center" prop="bcr"  />
      <el-table-column label="总数量" align="center" prop="sumSorting"  />
      <el-table-column label="读码率" align="center" prop="percentRead"  />
      <el-table-column label="分拣成功率" align="center" prop="percentSorting"  />
      <el-table-column label="分拣失败" align="center" prop="noreadSorting"  />
      <el-table-column label="回流数" align="center" prop="exceptionSorting"  />
      <el-table-column label="noread" align="center" prop="case1" min-width="100" />

      <el-table-column label="WCS未反馈目的地" align="center" prop="case4" min-width="140" />
      <el-table-column label="满格" align="center" prop="case6" min-width="100" />
      <el-table-column label="跟踪丢失" align="center" prop="case8" min-width="100" />
      <el-table-column label="间距过小" align="center" prop="case10"/>
      <el-table-column label="落格检测失败" align="center" prop="case13" min-width="120" />
      <el-table-column label="其他" align="center" prop="case11" min-width="120" />

      <el-table-column label="408异常" align="center" prop="case2" min-width="100" />
      <el-table-column label="其他响应异常" align="center" prop="successfulSorting"  />
      <el-table-column label="请求失败" align="center" prop="case38"  min-width="100"/>

<!--      <el-table-column label="5-wcs未收到请求" align="center" prop="case9"  min-width="140"/>-->


<!--      <el-table-column label="所有间距过小数量" align="center" prop="case28"  min-width="100"/>-->
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listUnusual,exportUnusual } from "@/api/system/WorkLog";

export default {
  name: "listUnusual",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 跟踪日志表格数据
      UnusualList: [],
        // 日期范围
        dateRange: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 出口编号
      bcrOptions: [],
      //分拣数量
      sumSortingOptions: [],
      successfulSortingOptions: [],
      exceptionSortingOptions: [],
      noreadSortingOptions: [],
      case1Options: [],
      case2Options: [],
      case4Options: [],
      case6Options: [],
      case8Options: [],
      case9Options: [],
      case10Options: [],
      case11Options: [],
      case13Options: [],
      case28Options: [],
      case38Options: [],




      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        bcr: null,
        sumSorting: null,
        successfulSorting: null,
        exceptionSorting: null,
        noreadSorting: null,
        case1: null,
        case2: null,
        case4: null,
        case6: null,
        case8: null,
        case9: null,
        case10: null,
        case11: null,
        case13: null,
        case28: null,
        case38: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    // // 字典查询
    // this.getDicts("${column.dictType}").then(response => {
    //   this.bcrOptions = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.sumSortingOptions = response.data;
    // });
    //
    // this.getDicts("${column.dictType}").then(response => {
    //   this.successfulSortingOptions = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.exceptionSortingOptions = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.noreadSortingOptions = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case1Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case2Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case4Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case6Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case8Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case9Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case10Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case11Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case13Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case28Options = response.data;
    // });
    // this.getDicts("${column.dictType}").then(response => {
    //   this.case38Options = response.data;
    // });
  },
  methods: {
    /** 查询跟踪日志列表 */
    getList() {
      this.loading = true;
          listUnusual(this.addDateRange(this.queryParams, this.dateRange)).then(
        response => {
        this.UnusualList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    // 道口编号
    bcrFormat(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.bcr);
    },
      sumSorting(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.sumSorting);
    },
      successfulSorting(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.successfulSorting);
    },
      exceptionSorting(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.exceptionSorting);
    },
      noreadSorting(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.noreadSorting);
    },
      case1(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case1);
    },
      case2(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case2);
    },
      case4(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case4);
    },
      case6(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case6);
    },
      case8(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case8);
    },
      case9(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case9);
    },
      case10(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case10);
    },
      case11(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case11);
    },
      case13(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case13);
    },
      case28(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case28);
    },
      case38(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.case38);
    },


    // 表单重置
    reset() {
      this.form = {
        creaTime: null,
        bcr: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },

    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有异常统计数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportUnusual(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    }
  }
};
</script>
